Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Language Guide / Part 2 - AppleScript Language Reference
Chapter 5 - Objects and References / Reference Forms


Middle Element

The Middle Element reference form specifies the middle object of a particular class in a container.

SYNTAX
middle className 
where

className is the class identifier for the specified object.

EXAMPLES
middle word of paragraph 1
middle item of {1, "doughnut", 33}
NOTES
AppleScript calculates the middle object with the expression ((n + 1) div 2), where n is the number of objects and div is the integer division operator. If there is an even number of objects in the container, the result is rounded down. For example, the middle word of a paragraph containing twenty words is the tenth word.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996